<!--
 * @Date: 2023-08-31 11:44:58
 * @LastEditTime: 2023-09-25 16:59:36
 * 介绍:
-->
<route lang="json">
{
  "meta": {
    "title": "t('wo-de-reng-wu')",
    "navbar": {
      "buttons": [
        {
          "icon": "icon-xialacaidan",
          "pubSubKey": "__wkMenu__"
        }
      ]
    }
  }
}
</route>
<script lang="ts" setup name="wk-myTask">
import { _require } from "@@/utils/tools";
import { apiWkMyAddTaskList, apiWkMyOrderTaskList } from "@@/api/wk/list";
import { WkTaskStatus } from "@@/enum/globalEnum";
import { addCache } from "@@/hooks/routeCache";
addCache("wk-myTask");

const { t } = useI18n();
const tabs1 = computed(() => [
  {
    title: t("quan-bu"),
    status: undefined,
  },
  {
    title: t("wei-wan-cheng"),
    status: WkTaskStatus.ORDER_ACCEPT, //WkTaskStatus.NOT_COMPLETE
  },
  {
    title: t("dai-shen-he"),
    status: WkTaskStatus.PENDING_AUDIT,
  },
  {
    title: t("zhong-cai-zhong"),
    status: WkTaskStatus.ARBITRATION,
  },
  {
    title: t("yi-wan-cheng"),
    status: WkTaskStatus.COMPLETE,
  },
  {
    title: t("yi-shi-bai"),
    status: WkTaskStatus.FAIL,
  },
]);

const tabs2 = computed(() => [
  {
    title: t("quan-bu"),
    status: undefined,
  },
  {
    title: t("dai-jie-zhong"),
    status: WkTaskStatus.ORDER_PENDING,
  },
  {
    title: t("yi-jie-dan"),
    status: WkTaskStatus.ORDER_ACCEPT,
  },
  {
    title: t("dai-shen-he"),
    status: WkTaskStatus.PENDING_AUDIT,
  },
  {
    title: t("zhong-cai-zhong"),
    status: WkTaskStatus.ARBITRATION,
  },
  {
    title: t("yi-wan-cheng"),
    status: WkTaskStatus.COMPLETE,
  },
  {
    title: t("yi-shi-bai"),
    status: WkTaskStatus.FAIL,
  },
]);
const active = reactive([]);
</script>
<template>
  <CpageView>
    <Rtabs v-model:active="active[0]">
      <VanTab :title="$t('jie-shou-de-reng-wu')">
        <Rtabs>
          <VanTab :title="tab.title" v-for="(tab, index) in tabs1" :key="index">
            <CrequestList
              :api="apiWkMyOrderTaskList"
              :params="{ status: tab.status }"
            >
              <template #item="{ item }">
                <BwkTaskListItem :item="item.task" :order-task="item" />
              </template>
            </CrequestList>
          </VanTab>
        </Rtabs>
      </VanTab>
      <VanTab :title="$t('fa-bu-de-reng-wu')">
        <Rtabs v-model:active="active[1]">
          <VanTab :title="tab.title" v-for="(tab, index) in tabs2" :key="index">
            <CrequestList
              :api="apiWkMyAddTaskList"
              :params="{ status: tab.status }"
            >
              <template #item="{ item }">
                <BwkTaskListItem :item="item" />
              </template>
            </CrequestList>
          </VanTab>
        </Rtabs>
      </VanTab>
    </Rtabs>
  </CpageView>
</template>
<style lang="scss" scoped>
.search {
  background-color: var(--C-M1-O1);
  border-radius: 999rem;
  padding: var(--gap-xs) var(--gap-md);
}
</style>
